<?php
namespace app\admin\validate;
use think\Validate;
class City extends Validate{
    
        protected $rule=[
            ['name','require|max:10','ciity名不为空|city长度不超过10'],
            ['uname','require|max:10','city英文名不为空|city英文名长度不超过10'],
            ['parent_id','number'],
            ['id','number'],
            ['is_default','number|in:0,1','默认为0|范围不合法'],
            ['status','number|in:-1,0,1','状态为数字|范围不合法'],
            ['listorder','number','排序为数字']
        ];
    
       /****场景设置****/
       protected  $scene=[
        "add"=>["name","uname","parent_id","id"],   //添加场景
         "listorder"=>["listorder","id"],//排序场景
         "status"=>["status","id"],//状态场景
         "default"=>["is_default","id"],//默认场景
           
       ];
}
